<template>
  <div class="m-life">
    <el-row>
      <el-col :span="14">
        <mCarousel></mCarousel>
      </el-col>
      <el-col :span="4">
        <div class="m-life-pic"></div>
      </el-col>
      <el-col :span="6">
        <div class="m-life-login" v-if="!user">
          <h4>
            <img src="//s0.meituan.net/bs/fe-web-meituan/e350c4a/img/avatar.jpg" alt />
          </h4>
          <p class="m-life-login-name">Hi!你好</p>
          <p>
            <nuxt-link to="/register">
              <el-button round size="medium">注册</el-button>
            </nuxt-link>
          </p>
          <p>
            <nuxt-link to="/login">
              <el-button round size="medium">立即登录</el-button>
            </nuxt-link>
          </p>
        </div>

        <div class="m-life-user" v-else>
          <h4>
            <img src="//s0.meituan.net/bs/fe-web-meituan/e3064a3/img/head-img.png" alt />
          </h4>
          <p class="m-life-user-name">{{user}}</p>
          <div class="m-life-row">
            <div class="m-life-item">
              <a href="/">
                <div class="m-life-icon">
                  <i class="el-icon-s-order"></i>
                </div>
                <div class="m-life-item-name">我的订单</div>
              </a>
            </div>
            <div class="m-life-item">
              <a href="/">
                <div class="m-life-icon">
                  <i class="el-icon-star-on"></i>
                </div>
                <div class="m-life-item-name">我的收藏</div>
              </a>
            </div>
            <div class="m-life-item">
              <a href="/">
                <div class="m-life-icon">
                  <i class="el-icon-s-ticket"></i>
                </div>
                <div class="m-life-item-name">抵用券</div>
              </a>
            </div>
          </div>
          
          <div class="m-life-row">
            <div class="m-life-item">
              <a href="/">
                <div class="m-life-icon">
                  <i class="el-icon-money"></i>
                </div>
                <div class="m-life-item-name">余额</div>
              </a>
            </div>
            <div class="m-life-item">
              <a href="/">
                <div class="m-life-icon">
                  <i class="el-icon-more"></i>
                </div>
                <div class="m-life-item-name">更多</div>
              </a>
            </div>
            
          </div>
          
          <div class="m-life-setting">
            <i class="el-icon-setting"></i>
          </div>
        </div>

      </el-col>
    </el-row>

    <el-row>
      <!-- 住酒店 -->
      <el-col :span="7">
        <div class="m-life-hotel"></div>
      </el-col>
      <!-- 涨姿势 -->
      <el-col :span="7">
        <div class="m-life-music"></div>
      </el-col>
      <!-- 我是商家 -->
      <el-col :span="4">
        <div class="m-life-coop"></div>
      </el-col>
      <!-- 二维码 ，美团APP手机版.....-->
      <el-col :span="6">
        <div class="m-life-downapp">
          <img src="//s1.meituan.net/bs/fe-web-meituan/60ac9a0/img/download-qr.png" alt="下载APP" />
          <p>美团APP手机版</p>
          <h4>
            <span class="red">1元起</span>
            <em class="gary">吃喝玩乐</em>
          </h4>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import mCarousel from "./carousel"
import { mapState } from 'vuex'
export default {
  data() {
    return {
    }
  },
  components: {
    mCarousel
  },
  computed: {
    // ...mapState({
    //   user: state => state.api.user.username
    // })
    user() {
      return this.$store.state.api.user.username
    }
  }
};
</script>
<style lang="scss">
@import "@/assets/css/index/life.scss";
</style>